#include <SFML/Graphics.hpp>

#include "Game.h"
//#include "GameState.h"
#include "PlayState.h"

void CPlayState::Init()
{
	/*shape = sf::RectangleShape(sf::Vector2f(40,20));
	shape.setPosition(20, 30);
	shape.setScale(2.0f, 1.0f);
	shape.setFillColor(sf::Color::Yellow);*/

	textures.load(Textures::Deska, "Textures/deska.png");
	sprite.setTexture(textures.get(Textures::Deska));
	sprite.setTextureRect(sf::IntRect(0, 0, 200, 60));
}

void CPlayState::CleanUp()
{
}

void CPlayState::Resume()
{
}

void  CPlayState::Pause()
{
}

void  CPlayState::HandleEvents(CGameEngine* game)
{
	sf::Event event;
	while (game->window.pollEvent(event))
	{
		if (event.type == sf::Event::Closed)
			game->window.close();
	}
}

void  CPlayState::Draw(CGameEngine* game)
{
	game->window.clear();
		
	//game->window.draw(shape);
	game->window.draw(sprite);

	game->window.display();
}

void  CPlayState::Update(CGameEngine* game)
{
	if (!game->window.isOpen())
		game->Quit();
}

CPlayState::CPlayState()
{
	Init();
}

CPlayState::~CPlayState()
{
	CleanUp();
}